<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center cardAndSafe_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub cardAndSafe_fd0_0'>
				<view class='flex flex-wrap align-center'>
					<person></person>
				</view>
				<view class='flex flex-wrap align-stretch justify-center flex-sub'>
					<text class='cardAndSafe_fd0_0_c1_c0'>我的发布</text>
				</view>
				<view class='flex flex-wrap align-center cardAndSafe_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		
		<view class="tabs">
			<view class="tabs_item" v-for="(item, index) in findTabs" :key="index" @tap.stop="selectTabs(item.aid)">
				<view :class="find_id == item.aid ? 'active_text' : ''">{{item.name}}</view>
				<image v-if="find_id == item.aid" :src='STATIC_URL+"106.png"' mode="aspectFill"></image>
			</view>
		</view>
		<view class="loading_css" v-if="isShow">
			<u-loading size="36" color="#6A0002"></u-loading>
			<view class="loading_text">加载中</view>
		</view>
		<view style="padding-top: 24rpx;" v-else>
			<view class="user_list">
				<view class="list_item" v-for="(item, index) in list" :key="index" @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/home/faxianDetails/index?id=${item.aid}`">
					<view style="position: relative;">
						<image class="image_1" :src='item.thumb' mode="aspectFill"></image>
						<view class="certified" v-if="item.is_real_person_auth == 1">
							已认证
						</view>
						<image v-if="item.is_video == 1" class="play_btn" :src='STATIC_URL+"97.png"' mode="aspectFill"></image>
						<image @tap.stop="delContent(item.aid)" class="del_btn" :src='STATIC_URL+"127.png"' mode="aspectFill"></image>
					</view>
					<view class="item_title" v-if="find_id == '2' || find_id == '3'">
						<text class="item_title_1" v-if="item.labels">{{item.labels}}</text>
						<text class="item_title_2">{{item.content}}</text>
					</view>
					<view class="item_label" v-if="find_id == '4'">
						<text class="label_1" v-for="(v, k) in item.labels" :key="k">{{v}}</text>
						<!-- <text class="label_2">160CM</text>
						<text class="label_3">40KG</text> -->
					</view>
					<view class="item_content" v-if="find_id == '4'">
						{{item.content}}
					</view>
					<view class="item_name">
						<image class="image_2" :src='item.head_img' mode="aspectFill"></image>
						<view>{{item.user_nickname}}</view>
					</view>
					<!-- <view class="item_like">
						<view class="like_content">
							<view class="like_item">
								<image :src='STATIC_URL+"107.png"' mode=""></image>
								<image :src='STATIC_URL+"108.png"' mode=""></image>
								<text>1100</text>
							</view>
							<view class="like_item">
								<image :src='STATIC_URL+"109.png"' mode=""></image>
								<text>1100</text>
							</view>
						</view>
					</view> -->
					<view class="item_date">
						<text>发布时间：</text>
						<text>{{item.create_time}}</text>
					</view>
				</view>
			</view>
			<u-loadmore v-if="last_page > 1" class="loadmore" font-size="24" :status="status" :icon-type="iconType"
				:load-text="loadText" />
			<view class="noData" v-if="list.length == 0 && !isShow">
				<image src="/static/empty/no.png"></image>
			</view>
		</view>
		
		<u-modal v-model="delShow" content="确定删除吗？" :show-cancel-button="true" confirm-color="#6A0002" @confirm="confirm"></u-modal>
	</view>
</template>
<script>
	import person from "@/components/person/index.vue"
	export default {
		components: {
			person
		},


		data() {
			return {
				current: 1,
				is_source: '2',
				findTabs: [],
				find_id: "",
				delShow: false,
				del_id: "",
				
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getFindType();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			
		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
		
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getList();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			getList() {
				this.$api.post(global.apiUrls.post6473222e217cf, {
					communitycate_id: this.find_id,
					page: this.page
				}).then(res => {
					uni.stopPullDownRefresh();
					this.isShow = false;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			
			// 获取发现分类
			getFindType() {
				this.$api.post(global.API_VERSION + '/647321a4177dc', {
					from: 'other'
				}).then(res => {
					if (res.data.code == 1) {
						this.findTabs = res.data.data;
						if (this.findTabs.length > 0) {
							this.find_id = this.findTabs[0].aid;
							this.getList();
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			selectTabs(aid) {
				this.find_id = aid;
				this.page = 1;
				this.is_pull = true;
				this.isShow = true;
				this.getList();
			},
			delContent(aid) {
				this.del_id = aid;
				this.delShow = true;
			},
			confirm() {
				this.delShow = false;
				this.$api.post(global.apiUrls.post65a206ce32168, {
					community_id: this.del_id
				}).then(res => {
					this.$message.info(res.data.msg);
					if (res.data.code == 1) {
						this.page = 1;
						this.is_pull = true;
						this.isShow = true;
						this.getList();
					}
				})
			},
		}
	};
</script>
<style lang="scss" scoped>
	.user_list {
		margin: 0 32rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	
		.list_item {
			background: #fff;
			border-radius: 16rpx;
			margin-bottom: 16rpx;
			width: 336rpx;
	
			.image_1 {
				width: 336rpx;
				height: 336rpx;
				border-radius: 16rpx 16rpx 0 0;
			}
			.play_btn {
				width: 64rpx;
				height: 64rpx;
				position: absolute;
				left: 50%;
				top: 50%;
				transform: translate(-50%,-50%);
			}
			.del_btn {
				width: 52rpx;
				height: 52rpx;
				position: absolute;
				right: 20rpx;
				top: 20rpx;
			}
	
			.item_title {
				padding: 0 20rpx;
				height: 85rpx;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				overflow: hidden;
				-webkit-line-clamp: 2;
				.item_title_1 {
					width: 62rpx;
					height: 34rpx;
					line-height: 32rpx;
					text-align: center;
					background: #E1CCCC;
					border-radius: 6rpx;
					font-size: 22rpx;
					color: #6A0002;
					margin-right: 12rpx;
				}
	
				.item_title_2 {
					font-size: 28rpx;
					line-height: 42rpx;
				}
			}
	
			.item_name {
				padding: 20rpx 0 24rpx 20rpx;
				display: flex;
				align-items: center;
				font-size: 24rpx;
	
				.image_2 {
					width: 36rpx;
					height: 36rpx;
					margin-right: 12rpx;
					border-radius: 50%;
				}
			}
	
			.certified {
				position: absolute;
				bottom: 16rpx;
				right: 16rpx;
				padding: 3rpx 15rpx;
				background: rgba(0, 0, 0, 0.5);
				border-radius: 18rpx;
				font-size: 24rpx;
				color: #fff;
				display: flex;
				align-items: center;
				justify-content: center;
			}
	
			.item_label {
				margin: 24rpx 0 0 0;
				padding: 0 20rpx;
	
				.label_1 {
					color: #6A0002;
					border-radius: 6rpx;
					padding: 2rpx 9rpx;
					background: #E1CCCC;
					font-size: 22rpx;
					margin-right: 16rpx;
				}
	
				.label_2 {
					color: #3582EB;
					border-radius: 6rpx;
					padding: 2rpx 9rpx;
					background: #D6E6FB;
					font-size: 22rpx;
					margin-right: 16rpx;
				}
	
				.label_3 {
					color: #5A912A;
					border-radius: 6rpx;
					padding: 2rpx 9rpx;
					background: #DEE9D4;
					font-size: 22rpx;
				}
			}
	
			.item_content {
				font-size: 28rpx;
				line-height: 42rpx;
				padding: 0 20rpx;
				margin-top: 16rpx;
				display: -webkit-box;
				overflow: hidden;
				text-overflow: ellipsis;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}
			.item_like {
				padding: 0 20rpx;
				.like_content {
					padding: 0rpx 20rpx 20rpx 0;
					border-bottom: 1rpx solid #eee;
					display: flex;
					justify-content: space-between;
					.like_item {
						display: flex;
						align-items: center;
						font-size: 26rpx;
						color: #666;
						image {
							width: 40rpx;
							height: 40rpx;
							margin-right: 8rpx;
						}
					}
				}
			}
			.item_date {
				padding: 24rpx 20rpx;
				font-size: 22rpx;
				color: #999;
				white-space: nowrap;
			}
		}
	}
	.tabs {
		display: flex;
		justify-content: space-between;
		align-items: center;
		background: #fff;
		padding: 24rpx 110rpx 0;
		.tabs_item {
			position: relative;
			font-size: 28rpx;
			color: #999;
			padding-bottom: 24rpx;
			.active_text {
				font-size: 32rpx;
				color: #333;
				font-weight: 500;
			}
		}
		image {
			width: 24rpx;
			height: 6rpx;
			position: absolute;
			bottom: 8rpx;
			left: 50%;
			transform: translateX(-50%);
		}
	}
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #f8f8f8;
		background-size: 100% auto !important;
	}

	.cardAndSafe_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.cardAndSafe_fd0_0_c2 {
		width: 40rpx;
		height: 40rpx;
	}

	.cardAndSafe_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.cardAndSafe_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.cardAndSafe_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.cardAndSafe_flex_1 {
		background: #fff;
		font-size: 32rpx;
		background-size: 100% auto !important;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.cardAndSafe_fd1_3 {
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.cardAndSafe_fd1_0_c1 {
		font-size: 26rpx;
		color: rgba(191, 191, 191, 1);
		font-weight: 400;
	}

	.cardAndSafe_fd1_0_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
	}

	.cardAndSafe_fd1_0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.cardAndSafe_flex_2 {
		height: 88rpx;
		position: fixed;
		bottom: 64rpx;
		left: 30rpx;
	}

	.cardAndSafe_fd2_0 {
		background: #6A0002;
		border-radius: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #fff;
		width: 690rpx;
		height: 88rpx;
		line-height: 88rpx;
	}
</style>